<?php
/** $Id: default_form.php 11917 2009-05-29 19:37:05Z ian $ */
	defined( '_JEXEC' ) or die( 'Restricted access' );
	$session = JFactory::getSession();
	$app = JFactory::getApplication();
	$template = JURI::base() . 'templates/' . $app->getTemplate();
	$eventID = JRequest::getVar('eventid');
	
	$user		= JFactory::getUser();
	$is_user = false; 
	$is_user_caterer = false; 
	foreach ($user->groups as $key => $value){
		if($value==9) {
			$is_user_caterer = true; 
		}
		if($value==2) {
			$is_user = true; 
		}
	}
?>
<script type="text/javascript">

jQuery(document).ready(function() {  

  //select all the a tag with name equal to modal
  jQuery('a[name=buyinfo]').click(function(e) {
	e.preventDefault();
	var option = 'com_jobs';
	var view = 'indholdviewcaterer';
	var format = 'raw';
	var task = 'viewInfo';
	var tmpl = 'ajax';
	var userid = <?php echo $user->get('id'); ?>;
	var eventID = <?php echo  $eventID; ?>;
	jQuery.ajax({
		url: 'index.php',
		type: 'POST',
		data: {'option':option,'view':view,'format':format,'task':task,'userid':userid,'eventid':eventID,'tmpl':tmpl},
		success: function(data) {
			if( data==2 ){
				jQuery('#alert').html('Venligst købe mere punkt<br><a href="index.php?option=com_jobs&view=kobopgaver">Køb Opgaver<a/>');
    			jQuery('#backoverlay').show();
    			jQuery('#show_popup').show();
			}
			else{
				jQuery("#list-caterers").html(data);
				jQuery(".bnt-buyinfo").remove();
			}
		}
	});	
  });
  //if close button is clicked
  jQuery('.window .close').click(function (e) {
    //Cancel the link behavior
    e.preventDefault();
    
    jQuery('#mask').hide();
    jQuery('.window').hide();
  });   
  
  //if mask is clicked
  jQuery('#mask').click(function () {
    jQuery(this).hide();
    jQuery('.window').hide();
  });
   
jQuery('.btn-luk').click(function () {
		
		jQuery('#mask').hide();
		jQuery('.window').hide();
  });
});
</script>  
<div id="header">
  <div id="w-header">
    <div class="logo"><a href="index.php">Forside</a> </div>
    <!--.logo-->
     {module login menu}    
    <!--.nav-top-1-->
    <div class="clear"></div>
    <div class="main-nav">
      {module main menu}
    </div>
    <!--.main-nav-->
    <div class="clear"></div>
  </div>
  <!--#w-header--> 
</div>
<!--#header-->

<div id="main">
  <div id="w-main">
    <div id="main-left">
	<div class="left-find"></div>
	<div class="right-find"></div>
		<div class="find">
			{module search}
		</div> 
      <!--.find-->
      <div class="clear"></div>
      <div class="infomation">
		<?php $article = JUtility::getArticle(15); ?>
        <h2><a href="#"><?php echo $article->title; ?></a></h2>
        <?php echo $article->introtext; ?>
      </div>
      <!--.infomation--> 
    </div>
    <!--#main-left-->
    <div id="main-right2">
       <div id="v-carterer-page">
       	<div class="v-carterer-page-content">
       		<h1>Caterrer (købte)</h1>
            <div id="list-caterers">
			
				<?php
				for($i=0;$i<count($this->allUsers);$i++)
					{
				?>
					<div class="caterer-item1">
						<h2><a href="#"><?php echo $this->allUsers[$i]->name;?></a></h2>
						<?php
						if(is_file($this->allUsers[$i]->image)) {
						?>
						<p><img src="timthumb.php?src=<?php echo $this->allUsers[$i]->image;?>&w=216" alt="" /><?php echo $this->allUsers[$i]->description;?></p>
						<?php }
						else   {
							?>
							<p><img width="216" height="133" alt="" src="<?php echo $template;?>/images/img-caterer-no.png"><?php echo $this->allUsers[$i]->description;?></p>
							<?php 
						}
						?>
					
					<?php if($this->paid) : ?>	
						<p><span>Telefon:</span> <?php echo $this->allUsers[$i]->phone;?></p>
						<p><span>Adresse:</span> <?php echo $this->allUsers[$i]->address;?></p>
						<p><span>Post/ By: </span> <?php echo $this->allUsers[$i]->postcode;?> <?php echo $this->allUsers[$i]->city;?> </p>
					<?php endif; ?>	
					</div><!--.caterer-item1-->
				<?php } ?>
			
			</div><!--#list-caterers-->
          </div><!--.v-carterer-page-->
			<?php if(!$this->paid && !empty($this->allUsers)) : ?>
			  <div class="bnt-buyinfo">
				<a href="#" name="buyinfo">Kob info</a>
			  </div>
			<?php endif; ?>	  
          <div class="bnt-back">
          	<a onclick="javascript:history.back();">Tilbage</a>
          </div><!--.bnt-back-->
          
       </div><!--#v-carterer-page-->
    </div>
    <!--#main-right--> 
  </div>
  <!--#w-main--> 
</div>
<!--#main-->
<div class="clear"></div>
<div id="contact">
  <div id="w-contact">
    <div class="left-con">
      <div class="left-con-top"></div>
      <!--left-con-top-->
      <div class="left-con-mid">
        <div class="contact-con">
		<?php $article = JUtility::getArticle(17); ?>
          <h2><a href="#"><?php echo $article->title; ?></a></h2>
          <?php echo $article->introtext; ?>
        </div>
        <!--.contact-con-->
        <div class="contact-con contact-con2">
			<?php $article = JUtility::getArticle(18); ?>
			<h2><a href="#"><?php echo $article->title; ?></a></h2>
			<?php echo $article->introtext; ?>
        </div>
        <!--.contact-con--> 
      </div>
      <!--left-con-mid-->
      <div class="left-con-bottom"></div>
      <!--left-con-bottom--> 
    </div>
    <!--.left-con-->
    
    <div class="address">
		<?php $article = JUtility::getArticle(16); ?>
		<h2><?php echo $article->title; ?></h2>
		<?php echo $article->introtext; ?>
    </div>
    <!--address--> 
    
    <div class="contact-form">
		{module kontakt}
    </div><!--.contact-form-->
  </div>
  <!--w-contact--> 
</div>
<!--#contact-->
<div class="clear"></div>
<div id="copyright">
	<div id="w-copyright">
		{module footer}
	</div>
</div>
<!--#copyright-->